package com.tengju.settlement.domain.model.depository;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 转账状态
 *
 * @author 大木
 * @date: 2021/12/6 9:17 下午
 */
@Getter
@AllArgsConstructor
public enum TransferStatus {

    WAIT_PROCESS(0,"待处理"),
    HAD_TRANSFER(1,"已转账"),
    HAD_PAYMENT(2,"已打款"),
    TRANSFER_REVOKE(3,"退票"),
    FAILED_TRANSFER(-1,"转账失败"),
    FAILED_CHARGE(-2,"打款失败"),
    ;

    Integer val;
    String desc;

    public static TransferStatus of(Integer code) {
        if (code == null) {
            return null;
        }

        for (TransferStatus type : values()) {
            if (type.val.equals(code)) {
                return type;
            }
        }
        return null;
    }
}
